import Cookies from 'js-cookie'

const TokenKey = 'LCLAIM-TOEKN'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token, rememberMe) {
  if (rememberMe) {
    return Cookies.set(TokenKey, token, { expires: 1 })
  } else {
    return Cookies.set(TokenKey, token)
  }
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

const RemotePageTokenKey = 'LCLAIM-REMOTEPAGE-TOEKN'
export function getRemotePageToken() {
  return Cookies.get(RemotePageTokenKey)
}

export function setRemotePageToken(token, rememberMe) {
  if (rememberMe) {
    return Cookies.set(RemotePageTokenKey, token, { expires: 1 })
  } else {
    return Cookies.set(RemotePageTokenKey, token)
  }
}

export function removeRemotePageToken() {
  return Cookies.remove(RemotePageTokenKey)
}
  /**
   * @description 远程页面路由列表
   */
const RemotePageListKey = 'LCLAIM-REMOTEPAGE-LIST'

export function getRemotePageList() {
  return Cookies.get(RemotePageListKey)
}

export function setRemotePageList(list, rememberMe) {
  if (rememberMe) {
    return Cookies.set(RemotePageListKey, list, { expires: 1 })
  } else {
    return Cookies.set(RemotePageListKey, list)
  }
}

export function removeRemotePageList() {
  return Cookies.remove(RemotePageListKey)
}
